<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>mat_2_graph</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab function</center>
    <div align="right">Last update : September 1995</div>
    <p>
      <b>mat_2_graph</b> -  graph from node-arc or node-node incidence matrix</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>g = mat_2_graph(a,directed,[mat])  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>a</b>
        </tt>: sparse node-arc or node-node incidence matrix</li>
      <li>
        <tt>
          <b>directed</b>
        </tt>: integer, 0 (undirected graph) or 1 (directed graph)</li>
      <li>
        <tt>
          <b>mat</b>
        </tt>: optional string, 'node-arc' or 'node-node' matrix</li>
      <li>
        <tt>
          <b>g</b>
        </tt>: graph list</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
      <tt>
        <b>mat_2_graph</b>
      </tt> computes the graph <tt>
        <b>g</b>
      </tt> corresponding to the node-arc 
    or the node-node incidence matrix <tt>
        <b>a</b>
      </tt>.
    Note that a checking is made to insure that <tt>
        <b>a</b>
      </tt> is a sparse node-arc 
    or node-node incidence matrix of a directed (<tt>
        <b>directed = 1</b>
      </tt>) or undirected 
    (<tt>
        <b>directed = 0</b>
      </tt>) graph.
    If the optional argument <tt>
        <b>mat</b>
      </tt> is omitted or is the string 
    <tt>
        <b>'node-arc'</b>
      </tt>, a must be a node-arc matrix. If <tt>
        <b>mat</b>
      </tt> is the string
    <tt>
        <b>'node-node'</b>
      </tt>, a must be a node-node matrix.</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

g=load_graph(SCI+'/demos/metanet/colored');
show_graph(g);
a=graph_2_mat(g);
g1=mat_2_graph(a,1);
g1('node_x')=g('node_x'); g1('node_y')=g('node_y');
show_graph(g1,'new');
a=graph_2_mat(g,'node-node');
g1=mat_2_graph(a,1,'node-node');
g1('node_x')=g('node_x'); g1('node_y')=g('node_y');
show_graph(g1,'new');
 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="adj_lists.htm">
        <tt>
          <b>adj_lists</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="chain_struct.htm">
        <tt>
          <b>chain_struct</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="graph_2_mat.htm">
        <tt>
          <b>graph_2_mat</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
  </body>
</html>
